package com.infonam.data.source.model;

import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;



@Entity
@Table(name="address", catalog="sakila")
public class Address {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="address_id", unique=true, nullable=false)
	private int address_id;
	@Column(name="address", length=50, nullable=false)
	private String address;
	@Column(name="address2",length=50, columnDefinition="VARCHAR(50) DEFAULT NULL")
	private String address2;
	private String district;
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="city_id", nullable=false)
	private City city_id;
	@Column(name="postal_code",length=10,columnDefinition="VARCHAR(20) DEFAULT NULL")
	private String postal_code;
	@Column(name="phone", length=20,nullable=false)
	private String phone;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="last_update", nullable=false, columnDefinition="Date default CURRENT_Date on update Date")
	private Date last_update;
	@OneToMany(mappedBy="address")
	private List<Customer> customerList = new LinkedList<Customer>();
	@OneToMany(mappedBy="address")
	private List<Store> storeList = new LinkedList<Store>();
	@OneToMany(mappedBy="address")
	private List<Staff> staffList = new LinkedList<Staff>();
	public int getAddress_id() {
		return address_id;
	}
	public void setAddress_id(int address_id) {
		this.address_id = address_id;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getAddress2() {
		return address2;
	}
	public void setAddress2(String address2) {
		this.address2 = address2;
	}
	public String getDistrict() {
		return district;
	}
	public void setDistrict(String district) {
		this.district = district;
	}
	public City getCity_id() {
		return city_id;
	}
	public void setCity_id(City city_id) {
		this.city_id = city_id;
	}
	public String getPostal_code() {
		return postal_code;
	}
	public void setPostal_code(String postal_code) {
		this.postal_code = postal_code;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public Date getLast_update() {
		return last_update;
	}
	public void setLast_update(Date last_update) {
		this.last_update = last_update;
	}
	public List<Customer> getCustomerList() {
		return customerList;
	}
	public void setCustomerList(List<Customer> customerList) {
		this.customerList = customerList;
	}
	public List<Store> getStoreList() {
		return storeList;
	}
	public void setStoreList(List<Store> storeList) {
		this.storeList = storeList;
	}
	public List<Staff> getStaffList() {
		return staffList;
	}
	public void setStaffList(List<Staff> staffList) {
		this.staffList = staffList;
	}
	
}
